﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MemoryLeak
{
    class Program
    {
        static void Main(string[] args)
        {
            for (int j = 0; j < 1000000; j++)
                for (int i = 0; i < 1000000; i++)
                    CactusFactory.CreateSomething();

            CactusFactory.CreateSomething();
        }

        public static class CactusFactory
        {
            private static List<Cactus> listOfSomethings = new List<Cactus>();

            public static Cactus CreateSomething()
            {
                var something = new Cactus();
                listOfSomethings.Add(something);
                return something;
            }
        }
    }
}
